package Tester;

import org.junit.Test;
import spaceCraft.Engine;
import spaceCraft.ProductInfo;
import Lander.*;

import static org.junit.Assert.assertTrue;

/**
 * Created by IntelliJ IDEA.
 * User: anton
 * Date: 23.03.12
 * Time: 19:03
 * To change this template use File | Settings | File Templates.
 */
public class LanderTest {
    private int velocity = 4000;
    private String manualGoodReport = "Sometime it's better to do it by myself.";
    private String manualBadReport = "Maybe this stuff was made in China!";
    private String autoGoodReport = "It's time to have a rest.";
    private String autoBadReport = "It's a miracle this garbage-can wasn't blown at once!";

    @Test
    public void testManualLandWithWorkingEngine() {
        Engine turboEngine = new Engine(new ProductInfo("RAF", "PRISTRIY#4"), velocity);
        LandMode landMode = new LandManually();
        assertTrue(landMode.land(turboEngine).contains(manualGoodReport));
    }

    @Test
    public void testManualLandWithBrokenEngine() {
        Engine turboEngine = new Engine(new ProductInfo("VAZ", "NIVA"), velocity);
        LandMode landMode = new LandManually();
        turboEngine.breakDevice();
        assertTrue(landMode.land(turboEngine).contains(manualBadReport));
    }

    @Test
    public void testAutoLandWithWorkingEngine() {
        Engine turboEngine = new Engine(new ProductInfo("VAZ", "KOPEYKA"), velocity);
        LandMode landMode = new LandUnderAutoPilot();
        assertTrue(landMode.land(turboEngine).contains(autoGoodReport));
    }

    @Test
    public void testAutoLandWithBrokenEngine() {
        Engine turboEngine = new Engine(new ProductInfo("ZAZ", "TAVRIYA"), velocity);
        LandMode landMode = new LandUnderAutoPilot();
        turboEngine.breakDevice();
        assertTrue(landMode.land(turboEngine).contains(autoBadReport));
    }
}
